package com.group9.nepmserver.controller;

import com.group9.nepmserver.dto.AfPageRequestDto;
import com.group9.nepmserver.dto.PageResponseDto;
import com.group9.nepmserver.pojo.AqiFeedback;
import com.group9.nepmserver.service.IAqiFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/aqiFeedback")
public class AqiFeedbackController {

    @Autowired
    private IAqiFeedbackService aqiFeedbackService;

    @RequestMapping("/saveAqiFeedback")
    public int saveAqiFeedback(@RequestBody AqiFeedback aqiFeedback) {
        return aqiFeedbackService.saveAqiFeedback(aqiFeedback);
    }

    @RequestMapping("/listAqiFeedbackByTelId")
    public List<AqiFeedback> listAqiFeedbackByTelId(@RequestBody AqiFeedback aqiFeedback) {
        return aqiFeedbackService.listAqiFeedbackByTelId(aqiFeedback.getTelId());
    }

    @RequestMapping("/listAqiFeedbackPage")
    public PageResponseDto<AqiFeedback> listAqiFeedbackPage(@RequestBody AfPageRequestDto afPageRequestDto){
        return aqiFeedbackService.listAqiFeedbackPage(afPageRequestDto);
    }

    @RequestMapping("/getAqiFeedbackById")
    public AqiFeedback getAqiFeedbackById(@RequestBody AqiFeedback aqiFeedback){
        return aqiFeedbackService.getAqiFeedbackById(aqiFeedback.getAfId());
    }

    @RequestMapping("/updateAqiFeedbackAssign")
    public int updateAqiFeedbackAssign(@RequestBody AqiFeedback aqiFeedback){
        return aqiFeedbackService.updateAqiFeedbackAssign(aqiFeedback);
    }

    @RequestMapping("/listAqiFeedbackByGmId")
    public List<AqiFeedback> listAqiFeedbackByGmId(@RequestBody AqiFeedback aqiFeedback){
        return aqiFeedbackService.listAqiFeedbackByGmId(aqiFeedback);
    }

    @RequestMapping("/updateAqiFeedbackState")
    public int updateAqiFeedbackState(@RequestBody AqiFeedback aqiFeedback){
        return aqiFeedbackService.updateAqiFeedbackState(aqiFeedback);
    }
}
